<?php

namespace App\Models;

class Role extends Base
{
    const STATUS_BEGIN       = 1; //启用
    const STATUS_STOP        = 2; //申请审核

    protected $table = 'wd_system_role';

    /**
     * 根据指定id获得对应的角色数据
     * @param  [type] $ids [description]
     * @return [type]      [description]
     */
    public static function getRoleObj($ids) {

        if ($ids == null) return [];
        $ids_arr = explode(',', $ids);
        return self::where('status',self::STATUS_BEGIN)
        ->whereIn('id', $ids_arr)
        ->get();
    }

    /**
     * 根据指定id获得对应的角色数据
     * @param  [type] $ids [description]
     * @return [type]      [description]
     */
    public static function getRoleArr($ids) {

        if ($ids == null) return [];

        $ids_arr = explode(',', $ids);
        return self::where('status',self::STATUS_BEGIN)
        ->whereIn('id', $ids_arr)
        ->get()
        ->toArray();
    }
}
